package com.quyl.poi.enums;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum KeyTypeEnum {

    ROW_KEY("ROW_KEY", "以行字段为key"), COL_KEY("COL_KEY", "以列字段为key");

    private String code;
    private String desc;

    public static KeyTypeEnum findByCode(String code) {
        if (StrUtil.isEmpty(code)) {
            return null;
        }
        for (KeyTypeEnum keyTypeEnum : values()) {
            if (StrUtil.equalsIgnoreCase(keyTypeEnum.code, code)) {
                return keyTypeEnum;
            }
        }
        return null;
    }

}
